﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;

namespace simpleHotel.Client.UserControls
{
    public partial class BaseCaptionControl : DevExpress.XtraEditors.XtraUserControl
    {      
        
        public event EventHandler<CaptionEventArgs> ButtonClick;
        protected virtual void OnButtonClick(CaptionEventArgs e)
        {
            if (this.ButtonClick != null)
                this.ButtonClick(this, e);
        }
        public string Title
        {
            get { return this.groupControl1.Text; }
            set { this.groupControl1.Text = value.ToUpper(); }
        }

        /// <summary>
        /// Gets or sets the allow export.
        /// </summary>
        /// <value>The allow export.</value>


        /// <summary>
        /// Gets or sets the allow search.
        /// </summary>
        /// <value>The allow search.</value>





        public BaseCaptionControl()
        {
            InitializeComponent();
            this.Title = string.Empty;
        }

        /// <summary>
        /// Adds the controls.
        /// </summary>
        /// <param name="ct">The ct.</param>
        public void AddControls(Control ct)
        {
            this.groupControl1.Controls.Add(ct);
        }

        /// <summary>
        /// Removes the control.
        /// </summary>
        /// <param name="ct">The ct.</param>
        public void RemoveControl(Control ct)
        {
            if (this.groupControl1.Controls.Contains(ct))
                this.groupControl1.Controls.Remove(ct);
        }

        /// <summary>
        /// Gets the base user control.
        /// </summary>
        /// <returns></returns>
        public BaseUserControl GetBaseUserControl()
        {
            for (int i = 0; i < this.groupControl1.Controls.Count; i++)
            {
                if (this.groupControl1.Controls[i] is BaseUserControl)
                    return (BaseUserControl)this.groupControl1.Controls[i];
            }
            return null;
        }
    }
    public class CaptionEventArgs : EventArgs
    {
        public string SearchText { get; set; }
        public CaptionButtonKind ButtonKind { get; set; }
        public CaptionEventArgs(CaptionButtonKind kind)
        {
            this.ButtonKind = kind;
        }
        public CaptionEventArgs(CaptionButtonKind kind, string searchText)
        {
            this.ButtonKind = kind;
            this.SearchText = searchText;
        }
    }

    public enum CaptionButtonKind
    {
    }
}
